package com.xiyu.service.framework.postOffice.protocol;

import jakarta.mail.Flags;
import jakarta.mail.Folder;
import jakarta.mail.Message;
import jakarta.mail.MessagingException;
import jakarta.mail.util.SharedByteArrayInputStream;

import java.util.LinkedHashMap;
import java.util.List;

public interface ReceiveProtocol {
    List<Folder> getAllFolder();

    String createFolder(String parentFolderName, String newFolderName);

    String renameFolder(String parentFolderName, String folderName, String newFolderName);

    void deleteFolder(String folderName);

    Folder getRootFolder();

    String getFolderName(Folder postOfficeFolder);

    String[] getFolderAttributes(Folder postOfficeFolder);

    LinkedHashMap<String, Message> getFolderMessages(Folder postOfficeFolder, int begin, int end);

    Folder getFolderByName(String folderName);

    int getFolderMailCount(Folder postOfficeFolder);

    int getFolderUnreadMailCount(Folder postOfficeFolder);

    int getFolderTopMailCount(Folder postOfficeFolder);

    void testGetMessage();

    LinkedHashMap<String, Message> getFolderUnreadMessages(Folder postOfficeFolder);

    LinkedHashMap<String, Message> getFolderTopMessages(Folder postOfficeFolder);

    void close();

    void openFolder(Folder postOfficeFolder, int mode);

    void closeFolder(Folder postOfficeFolder, boolean expunge);

    void setMessagesFlag(Folder postOfficeFolder, Message[] messages, Flags flags, boolean isTrue);

    Message[] getMessagesByUid(Folder postOfficeFolder, String[] uids);

    long[] moveMessages(Folder sourcePostOfficeFolder, Folder targetPostOfficeFolder, Message[] messages);

    void deleteMessages(Folder postOfficeFolder, Message[] messages);

    Message createMessage();

    String getNextUid(Folder postOfficeFolder);

    Message createMessage(SharedByteArrayInputStream inputStream) throws MessagingException;

}
